<?php

function upload($formname) {
    $fileupload = new FileUpload();
    $fileupload -> set("path", "../uploads/");
    if($fileupload -> upload($formname)) {
        $picname = $fileupload -> getFileName();
        // 创建图像对象
        $img = new Image("../uploads/");
        // 缩放两张图片，一个为原图，一个用来列表显示
        $img -> thumb($pic, 300, 300, "");
        $img -> thumb($pic, 100, 100, "thumb_");
        return $picname;
    } else {
        echo $fileupload -> getErrorMsg();
        return false;
    }
}
